var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, o) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var o in t)
              Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
          })(t, o);
      };
      return function (t, o) {
        function n() {
          this.constructor = t;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        e(t, o),
          (t.prototype =
            null === o
              ? Object.create(o)
              : ((n.prototype = o.prototype), new n()));
      };
    })(),
  StorageMoneyDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.max = 99),
        (t.min = 1),
        (t.step = 10),
        (t.num = 0),
        (t.storeSliderMoneyOutFn = {
          caller: t,
          code: 1457,
          method: function (e) {
            t.close();
          },
        }),
        (t.storeSliderMoneyINFn = {
          caller: t,
          code: 1451,
          method: function (e) {
            t.close();
          },
        }),
        (t.storeGoldMoneyOutFn = {
          caller: t,
          code: 1460,
          method: function (e) {
            t.close();
          },
        }),
        (t.storeGoldMoneyINFn = {
          caller: t,
          code: 1462,
          method: function (e) {
            t.close();
          },
        }),
        (t.onLoadSliverStoreFn = {
          caller: t,
          code: 1459,
          method: function (e) {
            ToastView.toastView(e.msg), t.close();
          },
        }),
        t.btn_money_cancle.on(Laya.Event.CLICK, t, t.close),
        t.btn_money_sure.on(Laya.Event.CLICK, t, t.onSureBtnClick),
        t.btn_moneyinout_plus.on(Laya.Event.CLICK, t, t.plusBtnClick),
        t.btn_moneyinout_dele.on(Laya.Event.CLICK, t, t.delBtnClick),
        t.slider_money_inout.on(Laya.Event.CHANGE, t, t.sliderChange),
        (t.text_money_InOut.restrict = "0-9"),
        t.text_money_InOut.on(Laya.Event.FOCUS, t, t.onFocus),
        t.text_money_InOut.on(Laya.Event.BLUR, t, t.onBlur),
        WebSocketService.addListener(t.storeSliderMoneyINFn),
        WebSocketService.addListener(t.storeSliderMoneyOutFn),
        WebSocketService.addListener(t.storeGoldMoneyINFn),
        WebSocketService.addListener(t.storeGoldMoneyOutFn),
        WebSocketService.addListener(t.onLoadSliverStoreFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showStorageView = function (e, o) {
        return (
          null == this.storageMoneyV &&
            ((this.storageMoneyV = new t()), (this.storageMoneyV.zOrder = 1e3)),
          this.storageMoneyV.popup(!0),
          (this.storageMoneyV.money_inout_mainTitle.text = e),
          (this.storageMoneyV.titleName = e),
          "银币存款" == e
            ? ((this.storageMoneyV.label_money_totalNum.text = "携带银币："),
              (this.storageMoneyV.label_money_InOut.text = "存储数量："),
              (this.storageMoneyV.label_storeinout.text = "携带："),
              (this.storageMoneyV.label_storetake.text = "存入："))
            : "银币取款" == e
            ? ((this.storageMoneyV.label_money_totalNum.text = "仓库银币："),
              (this.storageMoneyV.label_money_InOut.text = "取出数量："),
              (this.storageMoneyV.label_storeinout.text = "仓库："),
              (this.storageMoneyV.label_storetake.text = "提取："))
            : "金币存款" == e
            ? ((this.storageMoneyV.label_money_totalNum.text = "携带金币："),
              (this.storageMoneyV.label_money_InOut.text = "存储数量："),
              (this.storageMoneyV.label_storeinout.text = "携带："),
              (this.storageMoneyV.label_storetake.text = "存入："))
            : "金币取款" == e &&
              ((this.storageMoneyV.label_money_totalNum.text = "仓库金币："),
              (this.storageMoneyV.label_money_InOut.text = "取出数量："),
              (this.storageMoneyV.label_storeinout.text = "仓库："),
              (this.storageMoneyV.label_storetake.text = "提取：")),
          0 == o
            ? ((this.storageMoneyV.slider_money_inout.max = 0),
              (this.storageMoneyV.slider_money_inout.min = 0),
              (this.storageMoneyV.slider_money_inout.value = 0),
              (this.storageMoneyV.max = 0),
              (this.storageMoneyV.label_money_totalNum.text = "0个"),
              (this.storageMoneyV.label_money_InOut.text = "0币"),
              (this.storageMoneyV.text_money_InOut.text = "0"))
            : ((this.storageMoneyV.slider_money_inout.max = o),
              (this.storageMoneyV.slider_money_inout.min = 0),
              (this.storageMoneyV.slider_money_inout.value = 0),
              (this.storageMoneyV.max = o),
              (this.storageMoneyV.label_money_totalNum.text = o + "个"),
              (this.storageMoneyV.label_money_InOut.text = "0币"),
              (this.storageMoneyV.text_money_InOut.text = "0")),
          (this.storageMoneyV.min = 0),
          (this.storageMoneyV.num = 0),
          (this.storageMoneyV.maxValueMoney = o),
          (this.storageMoneyV.money_inout_mainTitle.text = e),
          this.storageMoneyV
        );
      }),
      (t.prototype.onFocus = function (e) {}),
      (t.prototype.onBlur = function (e) {
        var t = parseInt(e.text);
        this.maxValueMoney < t
          ? ((this.text_money_InOut.text = this.maxValueMoney + ""),
            (this.num = this.maxValueMoney))
          : (this.num = t),
          (this.slider_money_inout.value = this.num);
      }),
      (t.prototype.onSureBtnClick = function () {
        "银币取款" == this.titleName
          ? WebSocketService.send({
              c: 1457,
              d: { num: this.slider_money_inout.value, pwd: "123456" },
            })
          : "银币存款" == this.titleName
          ? WebSocketService.send({
              c: 1459,
              d: { num: this.slider_money_inout.value },
            })
          : "金币取款" == this.titleName
          ? WebSocketService.send({
              c: 1460,
              d: { num: this.slider_money_inout.value, pwd: "123456" },
            })
          : "金币存款" == this.titleName &&
            WebSocketService.send({
              c: 1462,
              d: { num: this.slider_money_inout.value },
            });
      }),
      (t.prototype.plusBtnClick = function () {
        (this.num = this.num + this.step),
          this.num > this.max && (this.num = this.max),
          (this.slider_money_inout.value = this.num),
          this.updateView();
      }),
      (t.prototype.delBtnClick = function () {
        (this.num = this.num - this.step),
          this.num < this.min && (this.num = this.min),
          (this.slider_money_inout.value = this.num),
          this.updateView();
      }),
      (t.prototype.sliderChange = function () {
        (this.num = this.slider_money_inout.value), this.updateView();
      }),
      (t.prototype.updateView = function () {
        (this.money_inout_mainTitle.text = this.titleName),
          (this.label_money_InOut.text = this.num + "币"),
          (this.text_money_InOut.text = this.num + "");
      }),
      (t.close = function () {
        this.storageMoneyV &&
          (this.storageMoneyV.close(), (this.storageMoneyV = null));
      }),
      t
    );
  })(ui.MoneyBankController.StorageMoneyDialogUI);
